#!/bin/bash
#
# Socialhome Docker Development entrypoint

# Exit immediately if a command exits with a non-zero status.
set -e

[[ -z "${CODE_DIR}" ]] &&  CODE_DIR="/data/prd/daimonblogv3"

cd $CODE_DIR

# Define help message
show_help() {
    echo """
Usage: docker run <imagename> COMMAND
Commands
runserver      : Run Django development server
bash           : Start a bash shell
python         : Run a python command
help           : Show this message
"""
}

# Run
case "$1" in
    bash)
        /bin/bash "${@:2}"
    ;;
    python)
        echo "Running python command..." "${@:2}"
        python3 "${@:2}"
    ;;
    help)
		show_help
	;;
	*)
        echo "Running Development Server..."
        python -m http.server --directory _website
    ;;    
esac
